<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>游戏卡</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="{$Think.const.RESOURCE}css/font.css">
    <link rel="stylesheet" href="{$Think.const.RESOURCE}css/xadmin.css">
    <link href="{$Think.const.RESOURCE}css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="{$Think.const.RESOURCE}css/bootstrap.min.css?v=3.3.6" rel="stylesheet">

    <script type="text/javascript" src="__PUBLIC__/home/js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="{$Think.const.RESOURCE}lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="{$Think.const.RESOURCE}js/xadmin.js"></script>
    <script type="text/javascript" src="{$Think.const.RESOURCE}js/bootstrap-paginator.js"></script>
    <style>
        .loc{
            color: #23c6c8;
        }
        .layui-table td, .layui-table th {
            position: relative;
            padding: 9px 8px;
            min-height: 20px;
            line-height: 20px;
            font-size: 14px;
        }
    </style>
</head>

<body class="layui-anim layui-anim-fadein">
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="">首页/游戏卡</a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:39px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so" action="{:U('gamecard/getOneByCard_no')}" METHOD="get" >
            <input type="text" value="{$condi.card_no}" name="card_no" placeholder="请输入单张游戏卡号"  class="layui-input"  >
            <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
            <a class="layui-btn layui-btn-danger" onclick="create_win()" style="float:right;margin-right:200px;"><i class="layui-icon"></i>增加批次</a>
        </form>
    </div>

    <xblock>
        <span class="x-right" style="line-height:40px;float:left;">共有数据:{$count}条</span>

    </xblock>
    <table class="layui-table">
        <thead>
        <tr>
            <th ><span style="display: inline-block; min-width: 60px;">批次名</span></th>
            <th ><span style="display: inline-block; min-width: 60px;">生成日期</span></th>
            <th ><span style="display: inline-block; min-width: 60px;color: #611300;">销售商</span></th>
            <th ><span style="display: inline-block; min-width: 60px;">卡片类型</span></th>
            <th ><span style="display: inline-block; min-width: 60px;">卡片数量</span></th>
            <th ><span style="display: inline-block; min-width: 60px;">单张卡金币数</span></th>
            <th ><span style="display: inline-block; min-width: 60px;">总金币数</span></th>
            <th ><span style="display: inline-block; min-width: 60px;">已充值</span></th>
            <th ><span style="display: inline-block; min-width: 60px;">未充值</span></th>
            <th >操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="lists" id="vo">
            <tr>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">
                    <a onclick='openW("{$vo['card_group']}" )' title="查看详细" >
                    <i class="iconfont" style="color:red;">&#xe699;</i>&nbsp;&nbsp;{$vo[card_group]}
                    </a>
                </td>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">{$vo[card_create_time]}</td>
                <td class="contact-type text-dark" style="border-left: 1px solid #f55200;color: #459102;">{$vo[card_owner]}</td>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">{$vo[card_type_name]}</td>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">{$vo[total]}</td>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">{$vo[card_gold]}</td>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">{$vo[total_gold]}</td>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">{$vo[czpeo]}</td>
                <td class="contact-type text-dark" style="border-left: 1px solid #DDDDDD;color: #2b2b2b;">{$vo[nczpeo]}</td>
                <td class="contact-type" style="font-size: 15px;text-align: center;width: 70px;" >
                    <if condition="$vo.card_type eq -2">
                        <a onclick='nodel_grounp("{$vo['card_group']}" )' title="解冻" class="contact-type" style="display:inline-block">
                        <i class="fa fa-lock loc"></i>
                        </a>
                        <else/>
                        <a onclick='del_grounp("{$vo['card_group']}" )' title="冻结" class="contact-type" style="display:inline-block">
                        <i class="fa fa-unlock loc"></i>
                        </a>
                    </if>
                    &nbsp;&nbsp;
                    <a onclick='exl_group("{$vo['card_group']}" )' title="导出为exlce" class="contact-type" style="display:inline-block">
                    <i class="iconfont" style="color:red;">&#xe718;</i>
                    </a>
                </td>
            </tr>
        </volist >
        </tbody>
    </table>
    <div class="page">
        <ul id="example"></ul>
        <input type="hidden" id="currentPage" value="{$p}">
        <input type="hidden" id="totalPages" value="{$totalPages}">
    </div>
</div>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#start' //指定元素
        });

        //执行一个laydate实例
        laydate.render({
            elem: '#end' //指定元素
        });
    });

    //查看游戏卡详细
    function openW(num){
        layer.open({
            type: 2,
            title: '游戏卡批次',
            shadeClose: true,
            shade: 0.8,
            maxmin: true,
            area: ['1400px', '80%'],
            content: '/gamecard/detail?card_group='+num //iframe的url
        });
    }



    ///增加卡的批次
    function create_win() {
        layer.open({
            type: 2,
            title: '增加批次',
            shadeClose: true,
            shade: 0.8,
            maxmin: true,
            area: ['1400px', '60%'],
            content: '/gamecard/create'//iframe的url
        });
    }

    //////冻结卡
    function del_grounp(num) {
        layer.confirm('您真的确定要冻结吗?', {
            btn : [ '确定', '取消' ]//按钮
        }, function(index) {
            $.get("/gamecard/dgroup", {card_group:num},function (data) {
                if  (data.code =='success') {
                    layer.msg('冻结成功!',{icon:1,time:1000});
                    window.location.reload();
                }else{
                    layer.msg('冻结失败!',{icon:2,time:1000});
                }
            });
        });
    }

    //解冻卡
    function nodel_grounp(num){
        layer.confirm('您真的确定要解冻吗?', {
            btn : [ '确定', '取消' ]//按钮
        }, function(index) {
            $.get("/gamecard/nodgroup", {card_group:num},function (data) {
                if  (data.code =='success') {
                    layer.msg('解冻成功!',{icon:1,time:1000});
                    window.location.reload();
                }else{
                    layer.msg('解冻失败!',{icon:2,time:1000});
                }
            });
        });
    }

    //导出卡
    function exl_group(num) {
        layer.confirm('确定导出吗?', {
            btn : [ '确定', '取消' ]//按钮
        }, function(index) {
            layer.open({
                type: 2,
                content: '/gamecard/exlgroup?card_group='+num,//iframe的url
            });
            layer.msg('导出成功',{time:1*1000},function() {
                layer.closeAll();
            })
        });
    }
    //分页
    $(function(){
        var  currentPage= $("#currentPage").val();
        var  totalPages= $("#totalPages").val();
        var options = {
            bootstrapMajorVersion:3, //对应的bootstrap版本
            currentPage: currentPage, //当前页数，这里是用的EL表达式，获取从后台传过来的值
            numberOfPages: 10, //每页页数
            totalPages:totalPages, //总页数，这里是用的EL表达式，获取从后台传过来的值
            shouldShowPage:true,//是否显示该按钮
            itemTexts:function (type, page, current){
                switch (type) {
                    case "first":
                        return "首页";
                    case "prev":
                        return "上一页";
                    case "next":
                        return "下一页";
                    case "last":
                        return "末页";
                    case "page":
                        return page;
                }
            },
            //点击事件
            onPageClicked: function (event, originalEvent, type, page) {
                var url='/gamecard/index.html';
                var str = url+'?p='+page+'&'+ $( "form" ).serialize();
                window.location.href = str;
            }
        };
        $('#example').bootstrapPaginator(options);
    });
</script>
</body>
</html>
